package com.study.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.study.entity.OperateLog;
import com.study.entity.PageBean;
import com.study.mapper.OperateLogMapper;
import com.study.service.OperateLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class OperateLogServiceImpl implements OperateLogService {
    @Autowired
    private OperateLogMapper operateLogMapper;

    @Override
    public PageBean opLog(Integer page, Integer pageSize) {
        PageBean pb = new PageBean();
        PageHelper.startPage(page,pageSize);
        Page logs =  (Page)operateLogMapper.selectAll();
        long total = logs.getTotal();
        List result = logs.getResult();
        pb.setTotal(total);
        pb.setRows(result);
        return pb;
    }
}
